package io;

import java.io.*;

/**
 * 对象流
 */
public class OOSDemo {
    public static void main(String[] args) throws IOException {
        String name="蔡徐坤";
        int age=25;
        String gender="男";
        String[] otherInfo={"是一名偶像练习生","擅长唱","跳","rap","篮球"};
        Student cxk=new Student(name,age,gender,otherInfo);

        //对象输出流在序列化对象时,必须保证序列化对象必须实现Serializable接口
        FileOutputStream fos=new FileOutputStream("./cxk.txt");
        ObjectOutputStream oos=new ObjectOutputStream(fos);
        oos.writeObject(cxk);
        oos.close();
        System.out.println("写出完毕!");
    }
}
